<!-- 通讯录的列表 -->
<template>
  <div class="contain">
    <!--search-->
    <div class="m-sech-wrap displayflex">
      <div class="flex1">
        <router-link to='/search?type=user' class="m-sech-box displayflex">
          <i class="iconfont icon-search"></i>
          <div class="flex1 m-sech-ipt">
            <div class="txt">{{sechTxt || '联系人名称/手机号'}}</div>
          </div>
        </router-link>
      </div>
      <router-link to="/mail/add" class="m-sech-classfiy">
        <i class="iconfont icon-add"></i>
        <p>新增</p>
      </router-link>
    </div>
    <div class='contact-list-wrap'>
      <div class="displayflex contact-list" @click="goDetail(item)" v-for="item in items">
        <div class="pic"><img src="~images/default/myfile_img.png"></div>
        <dl class="flex1 txt">
          <dt>{{item.Name}}</dt>
          <dd>{{item.UserBizType | role}} {{item.MobileNo}}</dd>
        </dl>
      </div>
    </div>
    <div class="noDate_page" v-if="items.length<=0">
      <div class="noDate_icon"><i class="iconfont icon-null"></i></div>
      暂无数据！
    </div>
    <manage-footer :status='3'></manage-footer>
  </div>
</template>

<script>
import manageFooter from "@/components/core/footer/manage.footer.vue";
export default {
  components: {
    manageFooter
  },
  data() {
    return {
      sechTxt: "",
      items: []
    };
  },
  created() {
    this.sechTxt = sessionStorage.sechtxt;
    this.getData();
  },
  methods: {
    goDetail(item) {
      this.$router.push({
        path: "/mail/detail",
        query:{
          StaffID:item.StaffID,
        }
      });
    },
    getData() {
      var self = this;
      var userinfo = JSON.parse(localStorage.userinfo);
      var query = {
        TenantGUID: userinfo.TenantGUID,
        CorpGuid: userinfo.CorpGuid,
        pageType: "list",
        Name: sessionStorage.sechtxt || "",
      };
      this.Ajax.post("SearchMfstaffbacies", query).then(function(resp) {
        if (resp.IsSuccess) {
          self.items = resp.Datas;
        } else {
          self.Toast({
            message: resp.ErrorMessage || "操作失败，请稍后重试"
          });
        }
      });
    }
  }
};
</script>